Repository navigation
fix(output)!: omit environment variables from the full --json report - #262
Merged
Merged
Conversation
The full report serialized Env for the target, every ancestor and every child. Agents that follow the README run `witr --port <PORT> --json`, so the environment of the user's shell and session ended up in their context. Tag model.Process.Env with json:"-". --env --json keeps printing the target's environment through ToEnvJSON, which builds its own struct. BREAKING CHANGE: Process.Env, Ancestry[].Env and Children[].Env are no longer part of `witr <target> --json`. Use `--env --json` to get a process's environment. Fixes pranshuparmar#261
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #261.
The full
--jsonreport serializedEnvfor the target, every ancestor and every child. Agents that follow the README runwitr --port <PORT> --jsonand read the environment of your shell and session into their context. I taggedmodel.Process.Envwithjson:"-".--env --jsonkeeps printing the target's environment, sinceToEnvJSONbuilds its own struct.Changes:
pkg/model/process.go:Env []string `json:"-"`, with a comment saying whyinternal/app/testdata/json_contract.golden: regenerated with-update, withoutProcess.Env,Ancestry[].EnvandChildren[].Envinternal/output/json_test.go:TestToJSONOmitsEnvchecks the full report carries neither theEnvkey nor a value from the fixture. It fails onstagingand passes with this change.README.mdsection 7.3: the full report row says environment variables are left out and points to--env --jsonplugins/witr/skills/witr/SKILL.md: the "Found" shape says the same, and warns that environment variables often hold secretsI also ran the binary on Linux against a process started with a dummy variable.
witr --port <PORT> --jsonreturns noEnvarray, andwitr --port <PORT> --env --jsonlists the variable.The change removes three fields from the JSON contract, so you'll want to call it out in the release notes. If you'd rather keep them behind a flag, I can rework the PR that way.
Type of change
Checklist
stagingbranch, with a Conventional Commits titlemake lintandmake testpass, and my changes add no new compiler,go vetor lint warnings_linux,_darwin,_freebsd,_windows): the change sits in the shared model, so every platform gets itEnvfrom the struct and doesn't go through JSON, so it still shows the environmentdocs/js/engine.js, fixtures regenerated): the playground'stoJSONnever emittedEnv, andnode docs/scripts/check-fixtures.mjspasses (26/26)--jsonfields are recorded in the JSON contract golden file: no new field, the golden file records the removal instead